#!/bin/sh

host=106.186.126.60
port=18010

date=$(date +%Y%m%d)
dir_name=image-server
host_dir=/data/vhosts/
tar_name=$dir_name-$date.tar.gz

command="cd $host_dir; mkdir -p $dir_name; cd $dir_name; tar xzf ../$tar_name"

rm -rf upload/*

tar czf "$tar_name" app cache server upload vendor
echo "begin deploy $tar_name"

scp -P $port "$tar_name" "root@$host:$host_dir"
ssh -p $port -l root "$host" $command
